﻿define('viewModels/editproject',
    ['data/projects',
        'logger',
        'router',
        'viewModel',
        'data/customers',
        'data'],
    function(
        projectDao,
        log,
        router,
        viewModel,
        customerDao,
        dataCore) {

        var view = function() {
            var self = this;

            function afterSave() {
                router.go('projectList');
            }

            viewModel.addEditItemBehavior(self, 'new project', 'edit project', projectDao, projectDao.Project, afterSave);
            self.activate = function(params, bind) {
                self.start(params, bind);
            };

            self.customers = function(initItem) {
                return dataCore.createLookup(customerDao.LookupLink, initItem);
            };
        };

        return new view();
    });